
<?php $attrId = array(); ?>
  @foreach($attributes as $key => $attribute)
      <div class="form-group form-float">
          <label style="margin-top:10px">{{$attribute['attr_name']}}</label>
          
          @if($attribute['attr_type'] == 1)
            <?php 
             
                  //判断循环的属性id是否出现过，否加进数组并改变opt 的值
                  if (in_array(@$attribute['attr_id'], $attrId)) {
                      $opt = '[-]';
                  } else {
                      if (@$attribute['attr_id']) {
                          $opt = '[+]';

                          $attrId[] = @$attribute['attr_id'];
                      } else {
                          $opt = '[+]';
                      }
                  }

                  if (empty($attribute['attr_value'])) {
                      $old='';
                  } else {
                      $old='old_';
                  }

            ?> 
            <a onclick="addnew(this)" attr-gaid="{{@$attribute['id']}}" href="javascript:void(0)">{{$opt}}</a>

          @endif
           @if($attribute['attr_option_values'])
                <div class="row">
                    <?php $_arr = explode('|', $attribute['attr_option_values']); ?>
                    <div class="col-lg-5">
                 <select class="form-control" name="@if(@$attribute['pid']) old_ga[{{@$attribute['attr_id']}}][{{@$attribute['id']}}] @else ga[{{@$attribute['attr_id']}}][{{@$attribute['id']}}] @endif" style="border: 1px solid #eee;">
                     <option value="">请选择</option>
                     @foreach($_arr as $akey => $arr)

                  <option value="{{$arr}}" @if($arr == @$attribute['attr_value']) selected @endif ">{{$arr}}</option>
                     @endforeach
                 </select>
                 </div>
                 @if($attribute['attr_type'] == 1)
                 <div class="col-lg-3">
                    <input type="text" class="form-control" name="@if(@$attribute['pid']) old_attr_price[{{@$attribute['attr_id']}}][{{@$attribute['id']}}] @else attr_price[{{@$attribute['attr_id']}}][{{@$attribute['id']}}] @endif" value="{{@$attribute['attr_price']}}"style="border-bottom:1px solid #aaa;" placeholder="价格"  />

                </div>
                <div class="col-lg-2">
                  <div class="input-group">
                     <span class="input-group-btn">
                       <a id="lfm{{$loop->index}}" data-input="thumbnail{{$loop->index}}" data-preview="holder{{$loop->index}}" class="lfm btn btn-sm btn-primary">
                         <i class="material-icons">add</i>
                       </a>
                     </span>
                     <input id="thumbnail{{$loop->index}}" class="form-control" type="text" name="filepath[{{@$attribute['attr_id']}}][{{@$attribute['id']}}]">
                   </div>
                   <img id="holder{{$loop->index}}"   style="width: 40px;
                                            height: 40px;
                                            position: absolute;
                                            top: -2px;
                                            display: none;
                                            left: 70px;
                                            border: none;">
                  
                </div>
                    </div>
                 @endif

                 @else
                 <div class="form-line">

                <input type="text" class="form-control" name="@if(@$attribute['pid']) old_ga[{{@$attribute['attr_id']}}][{{@$attribute['id']}}] @else ga[{{@$attribute['attr_id']}}][{{@$attribute['id']}}] @endif" value="{{@$attribute['attr_value']}}" />



              @endif
      </div>
      <script>
         $('#lfm{{$loop->index}}').filemanager('image');
      </script>
  @endforeach 

  @if($product->type_id != null) 
</div></div> 
   @endif
